﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Class.aspx.cs" Inherits="XHCTMS.VIEW.Class" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="apple-touch-icon" href="/apple-touch-icon.png">
    <link rel="stylesheet" href="css/style.css?v=2">
    <!-- fluid 960 -->
    <link rel="stylesheet" type="text/css" href="css/text.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="css/layout.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="css/grid.css" media="screen" />
    <!-- superfish menu -->
    <link rel="stylesheet" type="text/css" href="css/superfish.css" media="screen" />
    <!-- tags css -->
    <link rel="stylesheet" href="css/jquery.tagsinput.css">
    <!-- treeview css -->
    <link rel="stylesheet" href="css/jquery.treeview.css">
    <!-- dataTable css -->
    <link rel="stylesheet" href="css/demo_table_jui.css">
    <!-- fluid GS -->
    <link rel="stylesheet" type="text/css" href="css/fluid.gs.css" media="screen" />
    <!--[if lt IE 8 ]>
	<link rel="stylesheet" type="text/css" href="css/fluid.gs.lt_ie8.css" media="screen" />
	<![endif]-->
    <!-- //jqueryUI css -->
    <link type="text/css" href="css/custom-theme/jquery-ui-1.8.13.custom.css" rel="stylesheet" />
    <!-- //jquery -->
    <!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> -->
    <script src="js/libs/jquery-1.5.1.min.js"></script>
    <script>        !window.jQuery && document.write(unescape('%3Cscript src="js/libs/jquery-1.5.1.min.js"%3E%3C/script%3E'))</script>
    <!-- //jqueryUI -->
    <script type="text/javascript" src="js/jquery-ui-1.8.13.custom.min.js"></script>
    <script type="text/javascript" src="js/jquery-fluid16.js"></script>
    <script src="js/plugins.js"></script>
    <script src="js/script.js"></script>
    <!-- //xoxco tags plugin https://github.com/xoxco/jQuery-Tags-Input -->
    <script src="js/jquery.tagsinput.min.js"></script>
    <link rel="stylesheet" href="css/jquery.tagsinput.css">
    <!--[if lt IE 7 ]>
	<script src="js/libs/dd_belatedpng.js"></script>
	<script> DD_belatedPNG.fix('img, .png_bg');</script>
	<![endif]-->
    <!-- modernizr -->
    <script src="js/libs/modernizr-1.7.min.js"></script>
    <!-- superfish menu and needed js for menu -->
    <script src="js/superfish.js"></script>
    <script src="js/supersubs.js"></script>
    <script src="js/hoverIntent.js"></script>
    <!-- treeview -->
    <script src="js/jquery.treeview.js"></script>
    <!-- dataTable -->
    <script src="js/jquery.dataTables.min.js"></script>
    <link href="css/ACE.css" rel="stylesheet" type="text/css" />

    <style type="text/css">
      
    </style>
  
    <script type="text/javascript">
      var alterClassName ;
      $(function () {

          $("#dialogAdd").dialog({
              autoOpen: false, width: 530, modal: true,
              buttons: {
                  "增加": function () {
                      if ($("#lblAddPrompt").html().length <= 0) {
                          $("#txtAddClassName").trigger("onblur");
                      }
                      if ($("#lblAddPrompt").html().length <= 0) {
                          $("#btnAdd").trigger("click");
                      }

                  },
                  "取消": function () {
                      $(this).dialog("close");
                  }
              }
          })
          $("#dialogAlter").dialog({ autoOpen: false, width: 530, modal: true,
              buttons: {
                  "修改": function () {
                      if ($("#lblAlterPrompt").html().length <= 0) {
                          $("#txtAlterClassName").trigger("onblur");
                      }
                      if ($("#lblAlterPrompt").html().length <= 0) {
                          $("#btnAlter").trigger("click");
                      }
                  },
                  "取消": function () {
                      $("#lblAlterPrompt").html("");
                      $(this).dialog("close");
                  }
              }
          })

          $("#dialog_link1").click(function () {
              $("#lblAddPrompt").html("");
              $("#txtTempClassTea").val($("#ddlAddClassTea option:selected").val());
              $("#txtTempClassSub").val($("#ddlAddClassSub option:selected").val());
              $("#txtTempClassDep").val($("#ddlAddClassDep option:selected").val());

              $("#dialogAdd").dialog("open");
              //              if (verifyNull()) {
              //                  $("#btnAdd").trigger("click");
              //              }
          })

          $("#aFirst").click(function () {

              var page = '<%=Session["page"] %>';
              if (page == 1) {
                  return false;
              }
              $("#btnAFirst").trigger("click");
          });
          $("#aPrevious").click(function () {
              var ddlpage = $("#ddlPage  option:selected").text().split('/')[0];
              if (ddlpage <= 1) {
                  return false;
              }
              $("#btnAPrevious").trigger("click");
          });
          $("#aNext").click(function () {
              var ddlpage = $("#ddlPage  option:selected").text().split('/')[0];
              var maxpage = $("#ddlPage  option:selected").text().split('/')[1];
              if (ddlpage >= maxpage) {
                  return false;
              }
              $("#btnANext").trigger("click");
          });
          $("#aLast").click(function () {
              var ddlpage = $("#ddlPage  option:selected").text().split('/')[0];
              var maxpage = $("#ddlPage  option:selected").text().split('/')[1];
              if (ddlpage == maxpage) {
                  return false;
              }
              $("#btnALast").trigger("click");
          });


      })
        $(function () {
            $("#A2").click(function () {
                $("#btnSearch").trigger("click");
            });
        })

       
//        $(function () {
//            $("#Aalter").click(function () {
//                if ($("#txtTempClassID").val().length <= 0) {
//                    alert("请选择修改项");
//                    return false;
//                }
//                if (confirm("是否确定修改 " + alterClassName + " 信息")) {
//                    $("#btnAlter").trigger("click");
//                }

//              
//            })
//        })

        $(function () {
            $("#A1").click(function () {
                $("#btnDelete").trigger("click");
            })

            //            $("#example tbody tr").live("click", function () { $("#TextBox1").val($(this).attr("id")); alert($(this).attr("id")); });

        })

        function dialogNullPrompt(txtName, lblName,message) {
            if ($("#" + txtName).val().length <= 0) {
                $("#" + lblName).html(message);
                return false;
            }
            else {
                $("#" + lblName).html("");
                return true;
            }
//            if ($("#ddlClassUser option:selected").text().length <= 0) {
//                alert("请选择其班主任");
//                return false;
//            }
//            if ($("#ddlClassSub option:selected").text().length <= 0) {
//                alert("请选择其专业");
//                return false;
//            }
//            if ($("#ddlClassDep option:selected").text().length <= 0) {
//                alert("请选择其部门");
//                return false;
//            }
           
        }
      
        function selecter(t) {
            $("#txtTempClassID").val($(t).parent().parent().find("td :eq(0)").html());
            $("#txtAlterClassName").val($(t).parent().parent().find("td :eq(1)").html());
            alterClassName = $(t).parent().parent().find("td :eq(1)").html();
            var count = $("#ddlAlterClassTea option").length;
            var selecttext = $(t).parent().parent().find("td :eq(3)").html();
            for (var i = 0; i < count; i++) {
                if ($("#ddlAlterClassTea").get(0).options[i].text == selecttext) {
                    $("#ddlAlterClassTea ").get(0).options[i].selected = true;
                    break;
                }
            }
            var selecttext = $(t).parent().parent().find("td :eq(2)").html();
            var count = $("#ddlAlterClassSub option").length;
            for (var i = 0; i < count; i++) {
                if ($("#ddlAlterClassSub ").get(0).options[i].text == selecttext) {
                    $("#ddlAlterClassSub ").get(0).options[i].selected = true;
                    break;
                }
            }
            var selecttext = $(t).parent().parent().find("td :eq(4)").html();
            var count = $("#ddlAlterClassDep option").length;
            for (var i = 0; i < count; i++) {
                if ($("#ddlAlterClassDep ").get(0).options[i].text == selecttext) {
                    $("#ddlAlterClassDep ").get(0).options[i].selected = true;
                    break;
                }
            }

            $("#txtTempClassName").val($(t).parent().parent().find("td :eq(1)").html());
            $("#txtTempClassTea").val($("#ddlAlterClassTea option:selected").val());
            $("#txtTempClassSub").val($("#ddlAlterClassSub option:selected").val());
            $("#txtTempClassDep").val($("#ddlAlterClassDep option:selected").val());
            $("#dialogAlter").dialog("open");

        }


        function Graduation(t) {
            $("#txtTempClassID").val($(t).parent().parent().find("td :eq(0)").html());
            if (confirm($(t).parent().parent().find("td :eq(1)").html() + "是否确定毕业，毕业后将不能对其修改")) {
              $("#btnGraduation").trigger("click");
             }


      }
      function addtotemp(addName, tempName) {
          document.getElementById(tempName).value = document.getElementById(addName).value;
      }




     </script>
</head>
<body>
<div style="width:100%">
    <form id="form1"  runat="server">
    <div class="box">
        <h2>
            <a href="#" id="toggle-forms">班级管理</a>
        </h2>
        <div class="block" id="forms">
            <fieldset>
                <legend>操作区</legend>
                <div style="width:710px">
                    <label id="lblStuName">
                        班级名称</label>&nbsp;&nbsp;&nbsp;
                    <asp:TextBox ID="txtUpClassName" runat="server"  class="txt"></asp:TextBox>
                  
                    <label id="Label1">
                        班主任</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <label id="Label2">
                        <asp:DropDownList ID="ddlClassUser" runat="server" class="dropdownlist">
                        </asp:DropDownList>
                        <br />
                        所属专业</label>&nbsp;&nbsp;&nbsp;
                    <label id="Label4">
                        <asp:DropDownList ID="ddlClassSub" runat="server" class="dropdownlist">                           
                        </asp:DropDownList>&nbsp;&nbsp;&nbsp;
                        部门</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <asp:DropDownList ID="ddlClassDep" runat="server" class="dropdownlist">
                        </asp:DropDownList>
                    &nbsp;<label id="Label3">当前状态</label>&nbsp;                   
                    <asp:RadioButton ID="rbtnSchool" width="40px"  GroupName="state" Checked="true" runat="server" /><span>在校</span>
                    <asp:RadioButton ID="rbtnGraducat" width="40px"  GroupName="state" runat="server" /><span>毕业</span>
                    <br />
                    <div class="six column">
                        <a href="javascript:void(0)" id="dialog_link1" class=" dialog_link ui-state-default ui-corner-some floatRight">
                            <span class=" span-ui-icon ui-icon ui-icon-circle-plus "></span>增加</a>
                    </div>
                    <div class="six column">
                        <a href="javascript:void(0)" id="A2" class=" dialog_link ui-state-default ui-corner-some floatRight">
                            <span class=" span-ui-icon ui-icon ui-icon-search "></span>查询</a>
                    </div>
                    <asp:Button ID="btnAdd" runat="server" Text="Button" UseSubmitBehavior="false" Style="display: none" OnClick="btnAdd_Click" />
                    <asp:Button ID="btnSearch" runat="server" Text="Button2" Style="display: none" OnClick="btnSearch_Click" />
                    <asp:Button ID="btnAlter" runat="server" Text="Button3" UseSubmitBehavior="false" Style="display: none" OnClick="btnAlter_Click" />
                    
                    <asp:Button ID="btnGraduation" runat="server" Text="Button5"  Style="display: none"
                        onclick="btnGraduation_Click"   />
                    
                </div>
            </fieldset>
        </div>
    </div>
    <div class="box">
        <h2>
            <a href="#" id="toggle-list">班级信息表</a>
        </h2>
        <div class="block" id="list">
            <asp:Repeater ID="infolist" runat="server">
                <HeaderTemplate>
                    <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
                        <thead>
                            <tr>
                                <th width="18%">
                                    班级名称
                                </th>
                                <th width="28%">
                                    专业
                                </th>
                                <th>
                                    班主任
                                </th>
                                <th width="20%">
                                    部门
                                </th>
                                <th style="text-align: center">
                                    操作
                                </th>
                            </tr>
                        </thead>
                </HeaderTemplate>
                <ItemTemplate>
                    <tbody>
                        <tr class="odd gradeA">
                            <td style="display: none">
                            <label><%#Eval("class_id")%></label>
                            </td>
                            <td>
                              <label><%#Eval("class_name")%></label>
                            </td>
                            <td>
                               <label><%#Eval("sub_name")%></label>
                            </td>
                            <td>
                               <label><%#Eval("user_name")%></label>
                            </td>
                            <td>
                               <label><%#Eval("dep_name")%></label>
                            </td>
                            <td style="text-align: center">
                                <a  href="javascript:void(0)"; onclick="selecter(this)"  >修改</a>
                                &nbsp;&nbsp;&nbsp;
                                <a  href="javascript:void(0)"; onclick="Graduation(this)"  >毕业</a>
                            </td>
                        </tr>
                    </tbody>
                </ItemTemplate>
                <FooterTemplate>
                    <tfoot>
                       <tr>
                                <th>
                                    班级名称
                                </th>
                                <th>
                                   专业
                                </th>
                                <th>
                                    班主任
                                </th>
                                <th width="12%">
                                    部门
                                </th>
                                <th style="text-align: center">
                                    操作
                                </th>
                            </tr>
                    </tfoot>
                  
                </FooterTemplate>
            </asp:Repeater>
    </table>
                 	  
        

         <a id="aLast" href="#" class="dialog_link ui-state-default ui-corner-some floatRight " >尾页</a>
                                                         
			    <a id="aNext" href="#" class="dialog_link ui-state-default ui-corner-some floatRight" >下一页</a>
									                                        
                            <asp:DropDownList ID="ddlPage"  
                                
            class="dialog_link ui-state-default ui-corner-some floatRight" Width="85px"  AutoPostBack="true"
                                runat="server" 
            onselectedindexchanged="ddlPage_SelectedIndexChanged">
                            </asp:DropDownList> 
                           
				<a id="aPrevious"  href="#" class=" dialog_link ui-state-default ui-corner-some floatRight ">上一页</a>
                                          
                                         
				<a id="aFirst" href="#" class=" dialog_link ui-state-default ui-corner-some floatRight">首页</a>
    </div>
    </div>

    <div id="dialogAdd" title="新增班级" style=" display:none">
     &nbsp;&nbsp;&nbsp;班级名<input type="text" runat="server" id="txtAddClassName" onblur="dialogNullPrompt('txtAddClassName', 'lblAddPrompt','请填写班级名'); addtotemp('txtAddClassName','txtTempClassName');" class="txt" />
       &nbsp;&nbsp;&nbsp;班主任<select  id="ddlAddClassTea" runat="server" onchange="addtotemp('ddlAddClassTea','txtTempClassTea');" class="dropdownlist" ></select><br />
   &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;专业<select  id="ddlAddClassSub" runat="server" onchange="addtotemp('ddlAddClassSub','txtTempClassSub');" class="dropdownlist" ></select>
     &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;部门<select  id="ddlAddClassDep" runat="server" onchange="addtotemp('ddlAddClassDep','txtTempClassDep');" class="dropdownlist" ></select>
     <br /><br />
      &nbsp;&nbsp;&nbsp;<label id="lblAddPrompt" style="color:Red"></label>
     </div>
   
   <div id="dialogAlter" title="修改班级信息" style=" display:none"> 
        &nbsp;&nbsp;&nbsp;班级名<input type="text" runat="server" id="txtAlterClassName"  onblur="dialogNullPrompt('txtAlterClassName', 'lblAlterPrompt','请填写班级名');addtotemp('txtAlterClassName','txtTempClassName');" class="txt" />
       &nbsp;&nbsp;&nbsp;班主任<select  id="ddlAlterClassTea" runat="server" onchange="addtotemp('ddlAlterClassTea','txtTempClassTea');" class="dropdownlist" ></select><br />
   &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;专业<select  id="ddlAlterClassSub" runat="server" onchange="addtotemp('ddlAlterClassSub','txtTempClassSub');" class="dropdownlist" ></select>
     &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;部门<select  id="ddlAlterClassDep" runat="server" onchange="addtotemp('ddlAlterClassDep','txtTempClassDep');" class="dropdownlist" ></select>
     <br /><br />
      &nbsp;&nbsp;&nbsp;<label id="lblAlterPrompt" style="color:Red"></label>
   
   </div>

    <asp:TextBox ID="txtTempClassID" Style="display: none"  runat="server"></asp:TextBox>
    <asp:TextBox ID="txtTempClassName" Style="display: none"  runat="server"></asp:TextBox>
    <asp:TextBox ID="txtTempClassSub" Style="display: none"   runat="server"></asp:TextBox>
        <asp:TextBox ID="txtTempClassDep" Style="display: none"  runat="server"></asp:TextBox>
    <asp:TextBox ID="txtTempClassTea" Style="display: none" runat="server"></asp:TextBox>

    <asp:Button ID="btnPrevious" runat="server" Text="Button" Style="display: none" 
        onclick="btnPrevious_Click" />
    <asp:Button ID="btnFirst" runat="server" Text="Button" Style="display: none" 
        onclick="btnFirst_Click" />
    <asp:Button ID="btnLast" runat="server" Text="Button" Style="display: none"   onclick="btnLast_Click" />
    <asp:Button ID="btnNext" runat="server" Text="Button" Style="display: none"  onclick="btnNext_Click" />
    </form>
    </div>
</body>
</html>
